Skip to main content

Chapter 9 : React and TypeScript : The Production Grade Code

First Complete your TS playlist in Manual

TypeScript (TS) and its application with React requires a structured approach

1. Introduction to TypeScript:

1. Introduction to TypeScript:

a. What is TypeScript?

  • Content: Overview of TypeScript, its motivations, and its advantages over vanilla JS.
  • Task: Install TypeScript and set up a basic TypeScript project using tsc.

b. Basic Types in TypeScript:

  • Content: Introduction to basic data types in TS such as string, number, boolean, null, and undefined.
  • Task: Create simple variables of each type and try type-assertions and type-inferences.

c. Interfaces and Custom Types:

  • Content: Dive into defining shapes for objects using interfaces and type keyword.
  • Task: Create an interface for a user profile and a product in an online store.

2. Advanced TypeScript Concepts:

a. Union, Literal, and Intersection Types:

  • Content: Overview of combining types and defining specific set values.
  • Task: Define a type that could be a string or a number, and a type for specific string values (e.g., "small" | "medium" | "large").

b. Generics:

  • Content: Understand the power of reusability and dynamic types using generics.
  • Task: Create a generic function to return an array of any type.

c. Modules and Namespaces:

  • Content: Learn to organize and modularize the code using TS.
  • Task: Split the user profile and product interfaces into separate modules and import/export them.

d. Decorators:

  • Content: Dive into advanced TypeScript feature for class modification or decoration.
  • Task: Create a simple decorator to log class instantiations.

3. Setting up TypeScript with Tooling:

a. TSConfig:

  • Content: Understand the configuration options provided by TypeScript's tsconfig.json.
  • Task: Set up a project with specific compiler options like "strict" and "esModuleInterop".

b. Linting and Formatting:

  • Content: Introduce tools like TSLint or ESLint (with TS plugins) and Prettier.
  • Task: Set up linting and formatting for a TypeScript project and fix any linting issues.

4. TypeScript with React:

a. Setting up a TS-React Project:

  • Content: Introduction to create-react-app with TypeScript template.
  • Task: Bootstrap a new React project with TypeScript.

b. React Components in TypeScript:

  • Content: Understand how to define functional and class components in TS.
  • Task: Create a basic functional component with props using TypeScript.

c. State and Props with TypeScript:

  • Content: Dive deeper into how to type-check component props, state, and events.
  • Task: Develop a small app (e.g., a to-do app) where they define types for state and props.

d. Using third-party libraries with TypeScript:

  • Content: Introduction to DefinitelyTyped and using third-party libraries in a TS project.
  • Task: Install a library like lodash and use it in the project, ensuring it's type-safe.

5. Real-world Application Development:

a. Routing with TypeScript:

  • Content: Introduction to react-router with TypeScript.
  • Task: Extend the to-do app with routing, creating separate pages for viewing tasks and adding tasks.

b. State Management with TypeScript:

  • Content: Use state management libraries like Redux or Zustand with TypeScript.
  • Task: Refactor the to-do app to use Redux for state management, ensuring actions and reducers are type-safe.

c. API Calls and Data Fetching:

  • Content: Type-checking responses from APIs and handling them in React.
  • Task: Fetch a list of todos from a public API, type-check the response, and display it.

Ask Your Trainer for Production Code Example and Code

By progressing through this structured training roadmap, here you will not only grasp TypeScript's fundamental and advanced features but will also become proficient in integrating TypeScript with React, paving the way for creating robust, type-safe applications.

Clone FAANG Projects:

a. Clone Instagram App with TypeScript:

b. Clone Amazone App with TypeScript:

c. Clone NetFlix with TypeScript:

d. Clone Apple with TypeScript:

e. Clone Youtube with TypeScript:

By progressing through this structured training roadmap, here you will not only grasp TypeScript's fundamental and advanced features but will also become proficient in integrating TypeScript with React, paving the way for creating robust, type-safe applications.

Hey if you honestly completed all tasks from manual, then now you know how to build web apps with React

Now its up to your Dedication for Career Growth

but here is the tip for you : Learn New Tech everyday, and create new things for yourself

here are some technology which will be trending in future and you can also go for Full stack with NodeJS

-NEXT JS , -Recoil , -GraphQL , -Websockets (use with socket io) , -Firebase